/*
 * @Author: Hp_lucky 1063512385@qq.com
 * @Date: 2024-09-24 14:40:08
 * @LastEditors: Hp_lucky 1063512385@qq.com
 * @LastEditTime: 2024-10-23 20:32:44
 * @FilePath: \lucky-rpg\assets\script\src\Basic\Handle\WebRequest.ts
 */
import { MultiPlatform } from '../Model/Platform/MultiPlatform';
import { CallBackHandler } from '../Model/PoolObj/CallBackHandler';
/* eslint-disable */
export class WebRequestHttp {
  static requestGet(url: string, data: any, callback: (...args: any[]) => void, target?: any, ...params: any[]): void {
    const callbackFunc = CallBackHandler.pop(callback, target, params);
    const platform = MultiPlatform.Ins().platformUnit;
    platform.requestHttpGet(url, data, callbackFunc);
  }

  static requestPost(url: string, data: any, callback: (...args: any[]) => void, target?: any, ...params: any[]): void {
    const callbackFunc = CallBackHandler.pop(callback, target, params);
    const platform = MultiPlatform.Ins().platformUnit;
    platform.requestHttpPost(url, data, callbackFunc, {
      'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
      'Content-Type': 'application/json',
    });
  }
}
